package cn.edu.hit.education.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.edu.hit.education.dao.UserRoleMapper;
import cn.edu.hit.education.pojo.UserRole;
import cn.edu.hit.education.pojo.UserRoleExample;

/**
 * 
* <p>Title: UserRoleServiceImpl</p>  
* <p>Description: </p>  
* @author 罗成
* @date 2021年5月4日
 */
@Service
public class UserRoleServiceImpl implements IUserRoleService {
	
	@Autowired
	UserRoleMapper userRoleMapper;

	@Override
	public int queryRoleIdByUser(Integer id) {
		// TODO Auto-generated method stub
		return userRoleMapper.queryRoleIdByUser(id);
	}

	@Override
	public List<UserRole> queryRoleUserByUserId(long userId) {
		// TODO Auto-generated method stub
		UserRoleExample example = new UserRoleExample();
		UserRoleExample.Criteria criteria = example.createCriteria();
		criteria.andUseridEqualTo(userId);
		
		return userRoleMapper.selectByExample(example);
	}

}
